package com.example.weixinsystem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.weixinsystem.service.SysMenuService;
import com.example.weixinsystem.mapper.SysMenuMapper;
import com.weixin.common.core.entity.SysMenu;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.HashSet;
import java.util.Set;

/**
 * @author zhang
 */
@Service
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu>
        implements SysMenuService {

    /**
     * 获取用户所用户的权限标识
     *
     * @param userId 用户
     * @return
     */
    @Override
    public Set<String> getUserPossessMenu(Integer userId) {
        Set<String> menu = this.baseMapper.queryMenuByUserId(userId);
        if (CollectionUtils.isEmpty(menu)) {
            return new HashSet<>();
        }
        return menu;
    }
}
